﻿using IService;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Shops.Controllers
{
    public class RegistrationController : Controller
    {
        private IUserService service;
        public RegistrationController(IUserService service)
        {
            this.service = service;
        }

        public ActionResult RegisterNew()
        {
            return View(new User() { Profile = new Profile() });
        }

        [HttpPost]
        public ActionResult RegisterNew(User user)
        {
            user.Role = Role.User;
            //user.Id = Guid.NewGuid().ToString();
            user.CreateTs = DateTime.Now;

            var result = service.Insert(user);
            return View();
        }

    }
}
